package com.jie.other.jetpack.paging.db

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.jie.other.jetpack.paging.bean.DataPage

@Dao
interface DataPageDao {

    /**
     * 插入dataPage实体
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(dataPage: DataPage)

    /**
     * 根据指定id查询对应的DataPage
     */
    @Query("select * from data_page where dataPageId = :dataPageId")
    suspend fun getDataPage(dataPageId: String) : DataPage?

    /**
     * 删除指定id的DataPage
     */
    @Query("delete from data_page where dataPageId = :dataPageId")
    suspend fun delete(dataPageId : String)

}